package com.dji.sample.wayline.model.enums;

import java.util.Arrays;
import java.util.Optional;

/**
 * @ClassName lineTypeEnum
 * @Description
 * @Author yangjitao
 * @Date 2022/11/11 14:52
 **/
public enum LineTypeEnum {
    /**
     * 正常
     */
    NORMAL(0, "普通航线"),
    II_DIM_ORT(1, "二维正射"),
    FIRE_CHECK(2, "火情检测"),
    ;

    private int code;
    private String desc;

    LineTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static Optional<LineTypeEnum> getDescByCode(int code) {
        return Arrays.stream(values()).filter(s -> s.getCode() == code).findFirst();
    }
}
